#ifndef USER_CAPTURE_H
#define USER_CAPTURE_H

#include <QObject>
#include <QThread>

#include <QTimer>
#include <QImage>
#include <QPixmap>
#include <QList>
#include <QCameraInfo>

#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;

/*
    利用opencv打开读取保存图象
    新建一个线程读取图象 并通过外部传入算法处理图象
    这个类不做算法巨现
*/
class user_capture : public QThread
{
    Q_OBJECT

public:
    explicit user_capture(QObject *parent = nullptr);
    void run();

public:
    VideoCapture CVcap;
    VideoWriter VWriter;
    Mat src_image;
    Mat Panter_image;
    bool is_video_saving;
    bool is_cap_start;

    // kzfCaptureParm cameraParm;

    // kzfHoughCircleDetect circleD;

    // QList<kzfCirclebox> circleLists;

    // QList<QRectF> cRects;

public:
    QList<QString> user_cap_scan();//扫描摄像头
    bool user_cap_open(int index);
    bool user_cap_start(void);
    void user_cap_stop(void);
    void user_cap_close(void);

    QPixmap user_img_open(string path);//打开图片
    bool user_video_open(string path);//打开视频

    bool user_cap_save_img(string path);
    bool user_cap_save_video_start(string path);
    void user_cap_save_video_stop(void);

    void user_img_read_processing(void);
    void user_video_read_processing(void);
    void user_get_cap_parm(void);

    bool is_user_cap_opened(void);
    bool is_user_recording(void);

    double user_get(int propId);
    bool user_set(int propId, double value);

    int user_get_white_balance();
    int user_get_exposure();
    int user_get_saturation();
    int user_get_brightness();
    int user_get_gain();

    void user_set_white_balance(int value);
    void user_set_exposure(int value);
    void user_set_saturation(int value);
    void user_set_brightness(int value);
    void user_set_gain(int value);

public slots:


signals:
    void user_img_done(const QPixmap &);//只需要声明不需要定义
    // void user_circle_got(const int &);
};




#endif // USER_CAPTURE_H
